<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * Object.hasOwn(对象，键名): 是否是对象自身的属性
         * obj1.hasOwnProperty(j键名)
         * 
         * Object.assign(对象1，对象2) 合并对象
         *  相同键名会覆盖 
         *  是一个浅拷贝
         * 
         * 展开运算符 复制的对象或者数组 也是浅拷贝(最外面一层深拷贝，里层浅拷贝)
         * 
         * Object.is(); 判断对象是否相同
         * ===
         * Object.is(NaN, NaN) //true
         * NaN === NaN //false
         * 
         * Object.keys(对象) 
         * Object.values(对象)
         * 获取对象的所有键名 或者是键值 放在一个数组里
          */
        let obj = {
            name: '张丹',
            age: 12
        }
        console.log(Object.hasOwn(obj, 'name'));

        let obj1 = {
            name:"张三"
        }
        let obj2 = {
            age:20,
            name:"李四"
        }
        let obj3 = {
            height:"178cm"
        }
       let res =  Object.assign(obj1,obj2,obj3);
        //    console.log(res);
       obj1.name = "王五";
       console.log(res);

        // 展开运算符 复制的对象或者数组 也是浅拷贝
        let arr = [1,2,3,[6,7]];
        let arr2 = [...arr];
        arr[0] = 5; //第一层不改变
        arr[3][0] = 8; //第2层不改变
        console.log(arr2);

        let obj4 = {
            name: '张丹',
            age: 12
        }
        let res1 = Object.keys(obj4);
        let res2 = Object.values(obj4);

        console.log(res1);
        console.log(res2);
    </script>
</body>
</html>